package com.job.springSea.work0716;

/**
 * @author 于春海
 * @version 1.0
 * @since 2022-07-16 14:55:46
 */
public class StringBuffer02 {
    public static void main(String[] args) {
        String url="http://loclhost:8080/admin/table/tableList.html";
        StringBuffer sbf=new StringBuffer(url);
        String find="8080";
        String port="9000";
        int index=sbf.indexOf("8080");
        //开始下标包括 结束下标不包括
        sbf.replace(index, index+find.length(), port);
        url=sbf.toString();
        System.out.println(url);

        int lastIndex=sbf.lastIndexOf("table");
        sbf.delete(lastIndex,lastIndex+5);
        url=sbf.toString();
        System.out.println(url);

        sbf.insert(4,'s');
        url=sbf.toString();
        System.out.println(url);

        String src="24420";
        StringBuffer sbf2=new StringBuffer(src);
        String dest=sbf2.reverse().toString();
        if(src.equals(dest)){
            System.out.println("回文");
        }
    }
}